/**
 * @author Carlos Colmentares (06-39380)
 * @author Kelwin Fernandez (07-40888)
 */

#include "utils.h"
#include "state.h"
#include "clustering_instance.h"
#include <cmath>

double euclidean_distance(int n, double* a, double* b){
    
    double d = 0.0;
    int i = n;
    
    while( i--){
        double di = a[i] - b[i];
        d += di*di;
    }
    
    return sqrt(d);
}

double k_norm(int k, int n, double* a, double* b){
    
    double d = 0.0;
    double di;
    int i;
    
    for ( i=0; i<n; i++ ){
        di = a[i] - b[i];
        d += pow(di,k);
    }
    
    return pow(d, 1/k);
}
